{template 'common/header'}
<ol class="breadcrumb we7-breadcrumb">
	<a href="{php echo $this->createWebUrl('article');}"><i class="wi wi-back-circle"></i> </a>
	<li>
		<a href="{php echo $this->createWebUrl('article');}">文章管理</a>
	</li>
	<li>
		添加文章
	</li>
</ol>
<div class="clearfix">
	<form action="{php echo $this->createWebUrl('articlesave')}" method="post" class="we7-form" role="form" id="form1">
		<input type="hidden" name="article_id" value="{$article['article_id']}"/>
		
				<div class="form-group">
					<label class="col-sm-2 control-label">文章标题</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="article_title" value="{$article['article_title']}" placeholder="文章标题"/>
						<div class="help-block">请填写文章标题</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">文章分类</label>
					<div class="col-sm-8">
						<select name="article_cat" id="cat_id" class="form-control">
							<option value="">==请选择文章分类==</option>
							{loop $categorys $cat}
							<option value="{$cat['cat_id']}" {if $article['article_cat'] == $cat['cat_id']}selected{/if}>{$cat['cat_name']}</option>
							{/loop}
						</select>
						<div class="help-block">还没有分类，点我 <a href="{php echo $this->createWebUrl('category');}" target="_blank"><i class="fa fa-plus-circle"></i> 添加分类</a></div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">缩略图</label>
					<div class="col-sm-8">
						{php echo tpl_form_field_image('article_thumb', $article['article_thumb']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">简述</label>
					<div class="col-sm-8">
						<textarea name='article_desc' class="form-control">{$article['article_desc']}</textarea>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">内容</label>
					<div class="col-sm-8">
						{php echo tpl_ueditor('article_content', $article['article_content']);}
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">文章作者</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="article_author" value="{$article['article_author']}" placeholder="文章作者"/>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">阅读次数</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="article_clicks" value="{$article['article_clicks']}" placeholder="阅读次数"/>
						<div class="help-block">默认为0。您可以设置一个初始值,阅读次数会在该初始值上增加。</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">排序</label>
					<div class="col-sm-8">
						<input type="text" class="form-control" name="article_sort" value="{$article['article_sort']}" placeholder="排序"/>
						<div class="help-block">数字越大，越靠前。</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">是否显示</label>
					<div class="col-sm-8">
						<input type="radio" name="is_show" id="is_show-1" value="1" {if $article['is_show'] == 1} checked{/if}> 
						<label class="radio-inline" for="is_show-1">是</label>
						<input type="radio" name="is_show" id="is_show-0" value="0" {if $article['is_show'] == 0} checked{/if}>
						<label class="radio-inline" for="is_show-0"> 否</label>
					</div>
				</div>
			
		
		<div class="form-group">
			<div class="">
				<input type="submit" class="btn btn-primary"  value="提交" />
			</div>
		</div>
	</form>
</div>
<script>
	$(function(){
		$('#form1').submit(function(){
			if(!$.trim($(':text[name="article_title"]').val())) {
				util.message('请填写文章标题', '', 'error');
				return false;
			}
			if(!$.trim($('#cat_id').val())) {
				util.message('请选择文章分类', '', 'error');
				return false;
			}
			if(!$.trim($('textarea[name="article_content"]').val())) {
				util.message('请填写文章内容', '', 'error');
				return false;
			}
			return true;
		});
	});
</script>
{template 'common/footer'}
